package com.szml.config;

import com.szml.interceptors.JWTInterceptor;
import org.apache.logging.log4j.core.config.plugins.validation.constraints.NotBlank;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author limin
 * @date 2025-06-17 18:07
 * @description
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new JWTInterceptor())
//                .addPathPatterns("/**")  //拦截所有路径，进行token校验
                .addPathPatterns("/user/test")
//                .excludePathPatterns("/user/**");   //但是排除与用户有关的接口
                .excludePathPatterns("/user/login");   //但是排除与用户有关的接口
    }
}
